var tools = require('../../libs/tools');
var config = require(tools.rootPath + 'config');
var { connection, pool, model } = require(tools.rootPath + 'libs/model');

module.exports = {
  index: async function (req, res) {
    const { signature, nonce, timestamp, echostr } = req.query;
    if (echostr) {
      res.end(echostr);
      return;
    }
    var message = req.weixin;
    console.log(message);
    /*
{
ToUserName: 'gh_71a261ddfb0d',
FromUserName: 'oajSN5pnT1WyA9DdDJ_JE7vASN1M',
CreateTime: '1589448919',
MsgType: 'text',
Content: '222',
MsgId: '22755439424127350'
}
    */

    // let data = await model.find("select * from article where itemid=1");
    // console.log(data);
    res.reply('Hello world!');
  },
  subscribe: function () {

  },
  unsubscribe: function () {

  },
  scan: function () {

  }
}